package com.dindang.propertyfee.mvp.model;

import android.app.Application;

import com.dindang.propertyfee.mvp.contract.FeeAdvancedSearchContract;
import com.dindang.propertyfee.mvp.model.api.service.CommonService;
import com.dindang.propertyfee.mvp.model.entity.BaseResponse;
import com.dindang.propertyfee.mvp.model.entity.Build;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;
import retrofit2.http.Field;


@ActivityScope
public class FeeAdvancedSearchModel extends BaseModel implements FeeAdvancedSearchContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public FeeAdvancedSearchModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseResponse<List<Build.Building>>> findBuilding(Build.BuildParam param) {
        Observable<BaseResponse<List<Build.Building>>> base = mRepositoryManager.obtainRetrofitService(CommonService.class)
                .findBuilding(param.isAdmin,param.cId,param.corpId);
        return base;
    }

    @Override
    public Observable<BaseResponse<List<Build.Nodes>>> queryNodes(Build.NodesParam param, Map<String, String> cNodevaluesMap) {
        Observable<BaseResponse<List<Build.Nodes>>> base = mRepositoryManager.obtainRetrofitService(CommonService.class)
                .queryNodes(param.cCorpid, param.cNodecode, param.lv, cNodevaluesMap);
        return base;
    }
}